package com.xgst.land.activity.test

import com.blankj.utilcode.util.LogUtils
import com.gym.baselib.base.BaseActivity
import com.ht.medicaltreatment.serial.SerialPortUtils
import com.xgst.land.databinding.ActivityTestLayoutBinding
import com.xgst.land.utils.CRCUtils

class SerialPortTestActivity:BaseActivity<ActivityTestLayoutBinding>() {
    override fun viewBinding(): ActivityTestLayoutBinding {
        return ActivityTestLayoutBinding.inflate(layoutInflater)
    }

    override fun init() {
        //运行状态
        binding.tv1.setOnClickListener {
            SerialPortUtils.checkData()
        }

        //当前天线类型
        binding.tv2.setOnClickListener {
            val b = byteArrayOf(0x3A.toByte(), 0x03.toByte(), 0x00.toByte(), 0x28.toByte())
            val a  = CRCUtils.byteAddToByte(b, CRCUtils.getCrcData(b))
            LogUtils.i(a)
            SerialPortUtils.mSerialPortManager.sendBytes(a)
        }
    }
}